package concurrency.basicthreading.demo;

public class Demo12Joining {
	
	@SuppressWarnings("unused")
	public static void main(String[] args) {
		Demo12Sleeper 
			sleepy = new Demo12Sleeper("Sleepy", 1500),
			grumpy = new Demo12Sleeper("grumpy", 1500);
		
		Demo12Joiner
			dopey = new Demo12Joiner("dopey", sleepy),
			doc = new Demo12Joiner("doc", grumpy);
		
		/*
		 * doc线程将会调用grumpy线程的join方法等待grumpy醒来。但是在此过程中我们调用了grumpy线程interrupt()方法。
		 * 其结果是：doc线程与grumpy线程同时结束(也就是说，doc线程将不在继续执行尚未完成的任务)
		 */
		
		grumpy.interrupt();
	}
}
